package com.stc.activity;

import com.stc.pojo.Order;
import com.stc.pojo.Tactics;
import com.stc.utilities.DatabaseAdapter;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;


public class Stc1Activity extends Activity {
    
	DatabaseAdapter myDBAdapter;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Log.d("Stc1Activity","Stc1Activity");
        //String[] races = {String.valueOf(R.string.Protos), String.valueOf(R.string.Terran), String.valueOf(R.string.Zerg)};
    
        //database creation
        myDBAdapter = DatabaseAdapter.getHelper(getApplicationContext());  
        //myDBAdapter = new DatabaseAdapter(getApplicationContext());
        myDBAdapter.open();
         
        /*myDBAdapter.deleteAllTactic();
        myDBAdapter.deleteAllOrders();
	    myDBAdapter.deleteAllTactOrd();
        
        myDBAdapter.insertTactics(new Tactics("Attack", "W chuj ekstra atak", 1,1));
        myDBAdapter.insertTactics(new Tactics("Attack1", "Troche mniej w chuj ekstra atak",2,2));
        myDBAdapter.insertTactics(new Tactics("Defence1", "W chuj ekstra obrona",1,3));
        myDBAdapter.insertTactics(new Tactics("Defence2", "W chuj troche mnie ekstra oborna",3,4));
             
	    myDBAdapter.insertOrder( new Order("fight",1));
	    myDBAdapter.insertOrder( new Order("right",2));
	    myDBAdapter.insertOrder( new Order("now",3));
	      
	    myDBAdapter.insertTactOrd(1, 1, "00:02",1);
	    myDBAdapter.insertTactOrd(1, 2, "00:04",2);
	    myDBAdapter.insertTactOrd(1, 3, "00:06",3);*/
//        
        
        Button btnProtos = (Button)findViewById(R.id.protos);
        btnProtos.setOnClickListener(new OnClickListener() {
        	@Override
            public void onClick(View arg0) {
	            Intent intent = new Intent(Stc1Activity.this, ChooseTacticsActivity.class);
	            intent.putExtra("race", "Protos");
	            startActivity(intent);
            }
        });
        
        Button btnTerran = (Button)findViewById(R.id.terran);
        btnTerran.setOnClickListener(new OnClickListener() {
        	@Override
            public void onClick(View arg0) {
	            Intent intent = new Intent(Stc1Activity.this, ChooseTacticsActivity.class);
	            intent.putExtra("race", "Terran");
	            startActivity(intent);
            }
        });
        
        Button btnZerg = (Button)findViewById(R.id.zerg);
        btnZerg.setOnClickListener(new OnClickListener() {
        	@Override
            public void onClick(View arg0) {
	            Intent intent = new Intent(Stc1Activity.this, ChooseTacticsActivity.class);
	            intent.putExtra("race", "Zerg");
	            startActivity(intent);
            }
        });
        
        
        Button btnOptions = (Button)findViewById(R.id.options);
        btnOptions.setOnClickListener(new OnClickListener() {
        	@Override
            public void onClick(View arg0) {
	            //Intent intent = new Intent(Stc1Activity.this, ChooseTacticsActivity.class);
	            //startActivity(intent);
            }
        });
        
        Button btnAbout = (Button)findViewById(R.id.about);
        btnAbout.setOnClickListener(new OnClickListener() {
        	@Override
            public void onClick(View arg0) {
	            //Intent intent = new Intent(Stc1Activity.this, ChooseTacticsActivity.class);
	            //startActivity(intent);
            }
        });
        
       
    }
    
    protected void onDestroy() {
        myDBAdapter.close();
        super.onDestroy();
    }
    

}